<template>
	<view class="page">
		<status-bar :title="title"></status-bar>
		<backTop v-if='toTop'></backTop>
		<view class="list" v-if='list && list.length > 0'>
			<view class="item" v-for="(item,i) in list" :key='i' @click="toUrl('/otherPage/article/artDetail?artId='+item.website_article_id)">
				<view class="img-box">
					<image :src="item.website_article_img?imgUrl + item.website_article_img:staticUrl+'/images/imageLoading.png'" mode="aspectFill"></image>
					<text>查看详情</text>
				</view>
				<view class="title">{{ item.website_article_title }}</view>
				<view class="date">{{ item.website_article_addtime }}</view>
			</view>
			<view class="DiLine" v-if='list.length > 6'>------我也是有底线的------</view>
		</view>
		<empty v-if='noData' type='1' cat='3' msg='没有找到相关内容哦 ~'></empty>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				toTop: false,
				color: getApp().globalData.color,
				staticUrl: this.staticUrl,
				imgUrl: this.imgUrl,
				noData: false,
				list:[],
				title:'活动管理'
			};
		},
		onLoad() {
			this.getList()
		},
		methods:{
			getList() {
				this.$http.post({
					url: '/zzj_singleSaleApi/getArticle',
					data: {
						bid: uni.getStorageSync('bid'),
						listId: '35948',
						pagecount: 999,
						page: 1
					}
				}).then(res => {
					if(res.listTitle){
						this.title = res.listTitle
					}
					uni.setNavigationBarTitle({
						title: this.title
					})
					if(res.data){
						this.list = res.data
					}else{
						this.noData = true
					}
				})
			}
		},
		onPageScroll(e) {
			if (e.scrollTop > 250) {
				this.toTop = true;
			} else {
				this.toTop = false
			}
		},
		onShareAppMessage() {
			let shareData = uni.getStorageSync('shareData');
			let vid = uni.getStorageSync('vid')
			return {
				title: shareData.title,
				desc: shareData.desc,
				path: '/pages/index/index?share_v_id=' + vid,
				imageUrl: shareData.imageUrl
			}
		},
	}
</script>

<style lang="scss">
.page{
	.list{
		padding: 30rpx;
		.item{
			margin-bottom: 30rpx;
			.img-box{
				height: 344rpx;
				position: relative;
				image{
					width: 100%;
					height: 100%;
					border-radius: 12rpx;
				}
				text{
					position: absolute;
					right: 20rpx;
					bottom: 20rpx;
					background: rgba(255, 255, 255, 0.8);
					border-radius: 26rpx;
					padding: 10rpx 24rpx;
					color: #333333;
				}
			}
			.title{
				font-size: 30rpx;
				color: #000000;
				font-weight: bold;
				margin-top: 20rpx;
			}
			.date{
				color: #666666;
				margin-top: 6rpx;
			}
		}
	}
}
</style>
